#ifndef BLITTABLE_IMAGE_H
#define BLITTABLE_IMAGE_H

#include <GL/glew.h>
#include <FreeImage.h>

/** 
\author Zachary Wartell
\brief BlittableImage is an RGB image stored on the GPU that can be used in OpenGL blit operations

\warning BlittableImage constructors call OpenGL functions. Hence BlittableImage's can only be constructed after OpenGL is completely
initialized.

*/
class BlittableImage
    {
    public:
    BlittableImage();
    private:
	/**
	frameBufferObject_ is an off-screen OpenGL frame buffer object that allows us to use this BlittableImage's
	GPU-side image data as a source in OpenGL blit operations.

	(The Texture Object textureObject_ is 'attached' to this frameBufferObject_ ).
	*/
	GLuint frameBufferObject_;
    public:
	// get framebuffer (an OpenGL Frame Buffer Object)
	inline GLuint frameBuffer() { return frameBufferObject_; }

    private:
	unsigned int width_;
    public:
	// get image width
	inline unsigned int width() { return width_;}
    private:
	unsigned int height_;
    public:
	// get image height
	inline unsigned int height() { return height_;}

    private:
	// textureObject_ is an OpenGL texture object used to store this BlittableImage raster on the GPU
	GLuint textureObject_;

    private:
    // details in .cpp file
    static bool LoadTexture
	(
	const char* filename,  // IN: name of file to load
	FIBITMAP* & image,       // OUT: image
	unsigned int& width,   // OUT: width of loaded image 
	unsigned int& height,  // OUT: height of loaded image 
	BYTE* & bits	       // OUT: raw bytes of image (pointer points to storage in the '*image')	
	);
    };

#endif